window.addEventListener('scroll', function () {
    var imageContainers = document.querySelectorAll('.image-container');
    var windowHeight = window.innerHeight;

    imageContainers.forEach(function (container) {
        var containerTop = container.getBoundingClientRect().top;

        if (containerTop < windowHeight * 0.8) {
            container.classList.add('show');
        }
    });
});

window.addEventListener('DOMContentLoaded', function () {
    var imageItems = document.querySelectorAll('.image-item');

    imageItems.forEach(function (item) {
        item.addEventListener('mouseenter', function () {
            this.querySelector('img').style.transform = 'scale(1.2)';
        });

        item.addEventListener('mouseleave', function () {
            this.querySelector('img').style.transform = 'scale(1)';
        });
    });
});


// 退出功能示例
function logout() {
    sessionStorage.removeItem('name');
    sessionStorage.removeItem('id');
    window.location.href = 'main.html'; // 重定向到退出或登录页
}
